    const {http,handleStar}=require("../../utils/utils")
Page({   
    data: {
        books:[]
    },   
    onLoad(){
        var url='http://47.108.197.28:8000/book'
        http({
            url,
            success:res=>{
                // console.log(res.data)
                this.handleHttpData(res)
            }
        })
    },
    handleHttpData(res){
        var books=[]
        var playlists=res.data;
        playlists.forEach(item=>{
            var {coverImage,
                title,
                rating,
                evaluate,
                labels,
                price}=item;
                var labels = labels.join("/");
                books.push({
                    coverImage,
                    title,
                    rating,
                    star:handleStar(rating),
                    evaluate,
                    labels,
                    price
                })
        })
        this.setData({books})
    }

    
})